package cn.lzy.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author: gao dan
 * @CreateTime: 2023-11-06  01:51
 */
public interface zhuxiaob extends JpaRepository<zhuxiaoa,Integer> {
    zhuxiaoa findByUsername(String username);

    @Transactional
    @Query("select c.id from t_user c where c.username=?1")
    public Integer findByCustomer(String username);

    @Transactional
    @Modifying
    @Query("update t_user c set c.username=?1 where c.id=?2")
    public Integer updareCustomer(String username,Integer id);

    @Transactional
    @Modifying
    @Query("DELETE FROM t_user c WHERE c.username = ?1")
    int deleteUserByUsername(String username);
}
